package main

import (
	"net"
	"net/rpc"
	"net/rpc/jsonrpc"
)

type HelloService struct {
}

func (s *HelloService) Hello(req string, reply *string) error {
	*reply = "hello" + req
	return nil
}
func main() {

	rpc.RegisterName("hhh", new(HelloService))
	listen, err := net.Listen("tcp", ":8888")
	if err != nil {
		return
	}
	for {
		conn, err := listen.Accept()
		if err != nil {
		}

		go rpc.ServeCodec(jsonrpc.NewServerCodec(conn))

	}
}
